import Vue from 'vue'
import Router from 'vue-router'
import Login from '@/components/login/Login'
import Home from '@/components/home/Home'
import HomeRight from '../components/home/components/right.vue'
import Commodity from '../components/commodity/Commodity.vue'
import Category from '../components/commodity/Category.vue'
import ShopAdd from '../components/commodity/shopAdd.vue'
import categoryAdd from '../components/commodity/categoryAdd.vue'
import ViewProduct from '../components/commodity/ViewProduct.vue'   //查看商品
import UpdateMerchandise from '../components/commodity/UpdateMerchandise.vue'   //商品管理  修改商品
import Order from '../components/order/Order.vue'
import UserList from '../components/user/UserList.vue'
import echartsa from '../components/echarts/echarts1.vue'
import echartsb from '../components/echarts/echarts2.vue'
import echartsc from '../components/echarts/echarts3.vue'
import echartsd from '../components/echarts/echarts4.vue'
import baidu from '../components/echarts/baidu.vue'
import subCategory from '../components/commodity/subCategory.vue'
import lineitem from '../components/order/line-item.vue'     //订单详情

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/Login',
      name: 'Login',
      component: Login,
      meta:{title:"登录系统"}
    },
    {
      path: '/',
      name: 'Home',
      component: Home,
      meta:{
        requtreAuth:true,
        title:"系统首页"
      },
      children:[
        {
          path: 'HomeRight',
          name: 'HomeRight',
          component: HomeRight,
          meta:{
            requtreAuth:true,
            title:"首页"
          }
        },
        {
          path: 'Commodity',
          name: 'Commodity',
          component: Commodity,
          meta:{
            requtreAuth:true,
            title:"商品管理",
            keepAlive:true    //缓存部分页面（1）修改路由配置,需要缓存的（即切换页面后数据仍保留的）路由的keepAlive属性设置为true,不需要缓存的设置为false或者不设置（因为默认是false）
          }
        },
        {
          path: 'ShopAdd',
          name: 'ShopAdd',
          component: ShopAdd,
          meta:{
            requtreAuth:true,
            title:"商品管理-添加商品"
          }
        },
        {
          path: 'ViewProduct',
          name: 'ViewProduct',
          component: ViewProduct,
          meta:{
            requtreAuth:true,
            title:"查看商品"
          }
        },
        {
          path: 'UpdateMerchandise',       //商品管理  修改商品
          name: 'UpdateMerchandise',
          component: UpdateMerchandise,
          meta:{
            requtreAuth:true,
            title:"商品管理--修改商品",
            // keepAlive:false    //缓存部分页面（1）修改路由配置,需要缓存的（即切换页面后数据仍保留的）路由的keepAlive属性设置为true,不需要缓存的设置为false或者不设置（因为默认是false）
          }
        },


        {
          path: 'Category',
          name: 'Category',
          component: Category,
          meta:{
            requtreAuth:true,
            title:"品类管理"
          }
        },
        {
          path: 'categoryAdd',
          name: 'categoryAdd',
          component: categoryAdd,
          meta:{
            requtreAuth:true,
            title:"品类管理-添加品类"
          }
        },
        {
          path: 'subCategory',
          name: 'subCategory',
          component: subCategory,
          meta:{
            requtreAuth:true,
            title:"品类管理-查看子品类"
          }
        },
        {
          path: 'Order',
          name: 'Order',
          component: Order,
          meta:{
            requtreAuth:true,
            title:"订单管理"
          }
        },
        {
          path: 'lineitem',
          name: 'lineitem',
          component: lineitem,
          meta:{
            requtreAuth:true,
            title:"订单管理--订单详情"
          }
        },
        {
          path: 'UserList',
          name: 'UserList',
          component: UserList,
          meta:{
            requtreAuth:true,
            title:"用户列表"
          }
        },
        {
          path: 'echartsa',
          name: 'echartsa',
          component: echartsa,
          meta:{
            requtreAuth:true,
            title:"echarts图表 柱状图"
          }
        },
        {
          path: 'echartsb',
          name: 'echartsb',
          component: echartsb,
          meta:{
            requtreAuth:true,
            title:"echarts图表 折线图"
          }
        },
        {
          path: 'echartsc',
          name: 'echartsc',
          component: echartsc,
          meta:{
            requtreAuth:true,
            title:"echarts图表 饼状图"
          }
        },
        {
          path: 'echartsd',
          name: 'echartsd',
          component: echartsd,
          meta:{
            requtreAuth:true,
            title:"echarts图表 走势图"
          }
        },
        {
          path: 'baidu',
          name: 'baidu',
          component: baidu,
          meta:{
            requtreAuth:true,
            title:"baidu 地图"
          }
        },
      ],
      redirect:"/HomeRight"
    },
  ]
})


// UserList({pageNum:this.currpage}).then(data=>{
//   this.list=res.data.data.list
//   console.log(this.list)
// })
// this.getList()